#include <string.h>
#include "main.h"

extern void filter(void)
{
	char filter_text[300];
	int *i = danmu.index;
	SendMessage(edit.handle, WM_GETTEXT, sizeof filter_text, (LPARAM)filter_text);
	
	if (!filter_text[0])
	{
		for (; i != danmu.index_end; ++i)
			*i = abs(*i);
	}
	else
	{
		for (; i != danmu.index_end; ++i)
		{
			*i = abs(*i);
			if (NULL == strstr(danmu.head[*i].dat[CONTENT], filter_text))
				*i = -*i;
		}
	}
	
	insert_danmu();
}